<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Type extends Seller_Controller
{
	private static $data = array();
	protected $models=['type_model'];
	public function __construct()
	{
		parent::__construct();
	}

	//加载页面
	public function trade()
	{	    
        $this->type(1);
	}
	//加载页面
	public function job()
	{
	    $this->type(2);
	}
	//加载页面
	public function scale()
	{
	    $this->type(3);
	}
	//加载页面
	public function exp()
	{
	    $this->type(4);
	}
	//加载页面
	public function salary()
	{
	    $this->type(5);
	}
	//加载页面
	public function authen()
	{
	    $this->type(6);
	}
	//加载页面
	public function skill()
	{
	    $this->type(8);
	}
	
	//分类
	private function type($flag){
	    $type=$this->type_model->getWhere(['flag'=>$flag]);
	    self::$data['type']=$type;
	    self::$data['flag']=$flag;
	    $this->load->view('admin/type/list.html',self::$data);
	}
	//编辑分类
	public function editType(){
	    $data=$this->input->post();
	    $data = elements(array('typeId', 'typeName', 'displayOrder'), $data);
	    $res=$this->type_model->update($data['typeId'],$data);
	    if($res){
	        echo 200;
	    }
	}
	//添加分类入口
	public function addType_index(){
	    $this->load->view('admin/type/add.html');
	}
	//添加分类
	public function addType(){
	    $data=$this->input->post();
	    $res=$this->type_model->add($data);
	    if($res) echo 200;
	}
	//删除分类
	public function delType(){
	    $typeId=$this->input->post('typeId');
	    $res=$this->type_model->del($typeId);
	    if ($res) echo 200;
	}
	
	
	
}
/* End of file Login.php */